package com.adamfass.jmeutil;

import java.util.ArrayList;
import java.util.List;

import com.jme.input.joystick.Joystick;
import com.jme.input.joystick.JoystickInput;

public class Util {
  public static List<Joystick> getRealJoysticks(
      JoystickInput joystickInput) {
    ArrayList<Joystick> joysticks = new ArrayList<Joystick>();
    for (int i = 0; i < joystickInput.getJoystickCount(); i++) {
      final Joystick joystick = joystickInput.getJoystick(i);
      
      // Beta tester reported three joysticks named "Dell USB Keyboard Hub"
      if (joystick.getName().startsWith("Dell USB")) {
        System.out.println("Filtering out joystick: " + joystick.getName());
        continue;
      }
      
      joysticks.add(joystick);
    }
    return joysticks;
  }
}
